(function() {
	var cb_url = Path.getQuery("cb_url");

	function auto_login() {
		eventManager.is(App.get("loginer"), "getLoginer", function() {
			alert("success", "微信校验通过");
			Path.jump(cb_url || "http://i-zhubao.com/main.html");
		});
	};
	auto_login();
	App.set("$Event.weixin_login.no_jump", function() {
		Path.jump(cb_url || "http://i-zhubao.com/main.html");
	});
	var weixin_login_dtd = new $.Deferred();
	var wait = function(dtd, ms) {
		setTimeout(function() {
			if (App.get("loginer")) {
				dtd.resolve();
				clearTimeout(wait);
			} else {
				auto_login();
				wait(dtd, ms);
			}
		}, ms);
		return dtd;
	};
	$.when(wait(weixin_login_dtd, 5000)).then(function() {
		App.get("$Event.weixin_login.no_jump")();
	});
	// eventManager.is(App.get("loginer"), "getLoginer", function() {
	// 	alert("success", "微信校验通过");
	// 	Path.jump(cb_url || "http://i-zhubao.com/main.html");
	// });
}());